package test.orm;

import static org.junit.Assert.*;

import java.sql.Connection;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import zdy.web.orm.MyPool;

public class temypool {

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	 @Test
	    public void test1()
	    {        
	        //获得连接池
	        MyPool mypool = new MyPool();
	        
	        /*从连接池中尝试获取9个连接
	        for(int i = 0 ; i<9; i++){
	            Connection conn = mypool.getConnFromPool();
	            System.out.println(conn.toString());
	        }*/
	        
	        //获取第五个连接后，释放一下，然后再获取
	        for(int i = 0 ; i<9; i++){
	            Connection conn = mypool.getConnFromPool();
	            if(i==5){
	                mypool.releaseConnection(conn);
	            }
	            System.out.println(conn.toString());
	        }
	    }

}
